package com.kongwg.exer2;

public class Account {
	protected int id;
	protected double balance;
	protected double annualInterestRate;
	
	public Account() {
		super();
	}

	public Account(int id, double balance, double annualInterestRate) {
		super();
		this.id = id;
		this.balance = balance;
		this.annualInterestRate = annualInterestRate;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public double getBalance() {
		return balance;
	}

	public void setBalance(double balance) {
		this.balance = balance;
	}

	public double getAnnualInterestRate() {
		return annualInterestRate;
	}

	public void setAnnualInterestRate(double annualInterestRate) {
		this.annualInterestRate = annualInterestRate;
	}
	
	
	//获取月利率
	public double getMonthlyInterest(){
		return annualInterestRate/12;
	}
	//取钱
	public void withdraw (double amount){
		if(balance < amount){
			System.out.println("余额不足");
		}else{
			balance -=amount;
		}
	}
	
	//存钱
	public void deposit (double amount){
		balance +=amount;
	}
	
	
}
